API Documentation
Static Public Member Functions | List of all members
nkAstraeus::lua::UbyteArrayWrapper Class Referencefinal

Wraps a nkAstraeus::UbyteArrayData and offer functions for use in scripting. More...

Static Public Member Functions

static void updateEnvironment (nkScripts::Environment *env)
 
static nkScripts::OutputValue constructor (const nkScripts::DataStack &stack)
 
static void destructor (void *toDestroy)
 
static nkScripts::OutputValue getDataStr (void *data)
 
static nkScripts::OutputValue getData (void *data)
 
static nkScripts::OutputValue getSize (void *data)
 
static nkScripts::OutputValue subView (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue fromString (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue readDouble (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue writeDouble (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue readString (const nkScripts::DataStack &stack)
 
static nkScripts::OutputValue writeString (const nkScripts::DataStack &stack)
 

Detailed Description

Wraps a nkAstraeus::UbyteArrayData and offer functions for use in scripting.

Member Function Documentation

◆ updateEnvironment()

static void nkAstraeus::lua::UbyteArrayWrapper::updateEnvironment ( nkScripts::Environment env)
static

Updates a given environment and set it up to use all functions wrapped by this wrapper.

Parameters
envThe environment to set up.

◆ constructor()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::constructor ( const nkScripts::DataStack stack)
static

Wrapper function for the constructor of the user type.

local t = nkUbyteArray.new(10) ;
Parameters
stackThe parameter stack, containing an int for the size of the array wanted.
Returns
An output value with the user type and data allocated.

◆ destructor()

static void nkAstraeus::lua::UbyteArrayWrapper::destructor ( void *  toDestroy)
static

Wrapper function for the destructor of the user type.

Parameters
toDestroyThe data that has to be freed.

◆ getDataStr()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::getDataStr ( void *  data)
static

Wrapper function for the ArrayData::_ptr attribute reading, casted as a string.

local d = t.dataStr ;
Parameters
dataThe data from which the attribute will be retrieved.
Returns
The attribute value, as a string.

◆ getData()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::getData ( void *  data)
static

Wrapper function for the ArrayData::_ptr attribute reading.

local d = t.data ;
Parameters
dataThe data from which the attribute will be retrieved.
Returns
The attribute value, as a nkAstraeus::UbyteArrayData.

◆ getSize()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::getSize ( void *  data)
static

Wrapper function for the ArrayData::_size attribute reading.

local d = t.size ;
Parameters
dataThe data from which the attribute will be retrieved.
Returns
The attribute value.

◆ subView()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::subView ( const nkScripts::DataStack stack)
static

Wrapper function for ArrayData::subView.

local subView = t:subView(5, 10) ;
Parameters
stackThe parameter stack.
Returns
The output value, a nkAstraeus::UbyteArrayData.

◆ fromString()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::fromString ( const nkScripts::DataStack stack)
static

Utility function to populate the data from a string.

local t = nkUbyteArray.new(1):fromString("Hey") ;
Parameters
stackThe parameter stack.
Returns
The output value, a nkAstraeus::UbyteArrayData.

◆ readDouble()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::readDouble ( const nkScripts::DataStack stack)
static

Utility function to read an entry in an array as a double (8 bytes float).

local t = array:readDouble(0) ;
Parameters
stackThe parameter stack, containing an int for the offset in the array to read from.
Returns
The output value, a double.

◆ writeDouble()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::writeDouble ( const nkScripts::DataStack stack)
static

Utility function to write a double (8 bytes float) within an array.

local t = array:writeDouble(0, 50.4) ;
Parameters
stackThe parameter stack, containing an int for the offset in the array to write to, and the value.
Returns
The output value, empty.

◆ readString()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::readString ( const nkScripts::DataStack stack)
static

Utility function to read an entry in an array as a string.

local t = array:readString(0) ;
Parameters
stackThe parameter stack, containing an int for the offset in the array to read from.
Returns
The output value, a string.

◆ writeString()

static nkScripts::OutputValue nkAstraeus::lua::UbyteArrayWrapper::writeString ( const nkScripts::DataStack stack)
static

Utility function to write a string within an array.

local t = array:writeString(0, "Hey") ;
Parameters
stackThe parameter stack, containing an int for the offset in the array to write to, and the value.
Returns
The output value, empty.

The documentation for this class was generated from the following file: